package com.example.myblog.service;

import com.example.myblog.entity.ArticleInfo;
import com.example.myblog.mapper.ArticleMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleService {
    @Resource
    private ArticleMapper articleMapper;

    public int getArtCntByUid(Integer uid) {
        return articleMapper.getArtCntByUid(uid);
    }

    public List<ArticleInfo> getMyArtList(Integer uid) {
        return articleMapper.getMyArtList(uid);
    }

    public List<ArticleInfo> getListByPage(Integer psize,
                                           Integer offsize) {
        return articleMapper.getListByPage(psize, offsize);
    }

    public int del(Integer id, Integer uid) {
        return articleMapper.del(id, uid);
    }

    public int add(ArticleInfo articleInfo) {
        return articleMapper.add(articleInfo);
    }

    public int update(ArticleInfo articleInfo) {
        return articleMapper.update(articleInfo);
    }

    public ArticleInfo getArtDetail(Integer id) {
        return articleMapper.getArtDetail(id);
    }

    public int incrReadCnt(Integer id) {
        return articleMapper.incrReadCnt(id);
    }

    public int getCount() {
        return articleMapper.getCount();
    }
}
